package com.retirement.information.controller;

import com.retirement.common.core.controller.BaseController;
import com.retirement.common.core.domain.AjaxResult;
import com.retirement.common.core.page.TableDataInfo;
import com.retirement.information.domain.OldInformation;
import com.retirement.information.dto.OldInformationDto;
import com.retirement.information.service.OldInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *信息管理控制器
 * </p>
 *
 * @author lijy
 * @since 2023-12-19
 */
@RestController
@Api(value = "信息管理", tags = "信息管理")
@RequiredArgsConstructor
@RequestMapping("/information")
public class OldInformationController extends BaseController {

    private final OldInformationService oldInformationService;

    @GetMapping("/page")
    @ApiOperation(value = "分页查询基础信息")
    public TableDataInfo listOldInformation(OldInformationDto dto){
        startPage();
        return getDataTable(oldInformationService.getList(dto));
    }

    @PostMapping
    @ApiOperation(value = "新增基础信息")
    public AjaxResult addInformation(@RequestBody OldInformation dto){
        return AjaxResult.success(oldInformationService.addInformation(dto));
    }

    @PutMapping
    @ApiOperation(value = "修改基础信息")
    public AjaxResult updateInformation(@RequestBody OldInformation dto){
        return AjaxResult.success(oldInformationService.updateInformation(dto));
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除信息")
    public AjaxResult deleteById(@PathVariable("id") String id){
        return AjaxResult.success(oldInformationService.deleteById(id));
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "基础信息详情")
    public OldInformation getdetail(@PathVariable("id") String id){
        return oldInformationService.getdetail(id);
    }

    @DeleteMapping("/{userIds}")
    @ApiOperation("批量删除信息")
    public AjaxResult deleteByIds(@PathVariable String[] userIds){
        return null;
    }

}
